<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>留言板</title>
</head>
	
<body>
	
	<table border="1" width="750">
		<tr>
			<td>标题</td>
			<td>留言时间</td>
		</tr>
		<?php foreach ($db as $id => $d):?>
		<tr>
			<td>
				<img src="<?php echo $d['icon'];?>">
				
				<?php echo $d['title'];?>
				<a href="javascript:;" onclick = "confirm('确定删除吗')?location.href='index.php?a=del&id=<?php echo $id;?>':''">删除</a>
			</td>
			<td><?php echo $d['time'];?></td>
		</tr>
		<?php endforeach;?>
	</table>

	<h4>发表留言：</h4>

	<form action="?a=post" method="post">
		<table border="1" width="750">
			<tr>
				<td>标题</td>
				<td><input type="text" name="title" ></td>
			</tr>
			<tr>
				<td>留言内容</td>
				<td><textarea name="body" cols="30" rows="10"></textarea></td>
			</tr>
			<tr>
				<td>头像</td>
				<td>
					<!-- 遍历所有的图片  把图片输出到单元格中 -->
					<?php foreach ($icons as $icon):?>

						<input type="radio" name='icon' value="<?php echo $icon;?>" checked="">

						<img width='50' src="<?php echo $icon;?>" >

					<?php endforeach;?>

				</td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="提交留言"></td>
			</tr>
		</table>
	</form>


</body>
</html>
